๐Ÿ”ฅFinal Project Day 4 - Grid Line ์— ์ด๋ฆ„ ๋ถ™์ด๊ธฐ

๐Ÿ„Grid Line ์— ์ด๋ฆ„ ๋ถ™์—ฌ์„œ ์ˆซ์ž ๋Œ€์‹  ์‚ฌ์šฉํ•˜๊ธฐ

grid-template-columns: repeat(4, 100px); ๋ผ๊ณ  ์ž‘์„ฑํ–ˆ์ง€๋งŒ ์—ฌ๊ธฐ์— ๋” ๊ตฌ์ฒด์ ์œผ๋กœ ๊ทธ๋ฆฌ๋“œ ๋ผ์ธ์˜ ์ด๋ฆ„์„ ํ•จ๊ป˜ ํ‘œ์‹œํ•ด ์ค„ ์ˆ˜ ์žˆ์—ˆ๋‹ค.

/* Line ๋ณ„๋กœ ์ด๋ฆ„ ๋ถ™์ด๊ธฐ */
.grid {
  display: grid;
  gap: 10px;

  grid-template-columns: [first-line] 100px [second-line] 100px [third-line] 100px [fourth-line] 100px [fifth-line];

  grid-template-rows: repeat(4, 100px [sexy-line]);
}

๊ทธ๋ ‡๊ฒŒ ๋˜๋ฉด, grid-column: 1 / -2 ์ฒ˜๋Ÿผ ์ˆซ์ž๋กœ ํ‘œ๊ธฐํ•œ ์‚ฌํ•ญ์„ ์•ž์„œ ์ง€์–ด์ค€ ์ด๋ฆ„์œผ๋กœ ๋ฐ”๊พธ์–ด ์ ์„ ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

.header {
  background: #2ecc71;

  grid-column: span 4;
}
.content {
  background: #3498db;

  /* grid-column: 1 / -2; ๋ฅผ ์•„๋ž˜๋กœ ๋Œ€์ฒด*/
  grid-column: first-line / fourth-line;

  /* grid-row: span 2; ๋ฅผ ์•„๋ž˜๋กœ ๋Œ€์ฒด */
  grid-row: sexy-line 1 / sexy-line 3;
}
.nav {
  background: #8e44ad;

  grid-row: span 2;
}
.footer {
  background: #f39c12;

  grid-column: span 4;
}

Written by@[DotoriMook]
ํ”„๋ก ํŠธ์—”๋“œ ์ฃผ๋‹ˆ์–ด ๊ฐœ๋ฐœ์ž ๋„ํ† ๋ฆฌ๋ฌต์˜ ๊ธฐ์ˆ ๊ฐœ๋ฐœ ๋ธ”๋กœ๊ทธ ์ž…๋‹ˆ๋‹ค.

GitHubMediumTwitterFacebook